//
//  BHStadiumlistNavigationBar.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/7/1.
//

import UIKit
protocol BHStadiumlistNavigationBarDelagete {
    func didStadiumNavigationBarSelectIndex(index: Int)
}

class BHStadiumlistNavigationBar: UIView {

    
    @IBOutlet weak var backBtn: UIButton!
    
    @IBOutlet weak var stadiumBtn: UIButton!
    
    @IBOutlet weak var medicalBtn: UIButton!
    
    
    var delegate: BHStadiumlistNavigationBarDelagete?
    
    
    static func loadFromXib() -> BHStadiumlistNavigationBar {
        let viewArray = Bundle.main.loadNibNamed("BHStadiumlistNavigationBar", owner: nil, options: nil)
        let view: BHStadiumlistNavigationBar = viewArray![0] as! BHStadiumlistNavigationBar
        return view
    }
    
    @IBAction func changeAct(_ sender: UIButton) {
        if sender.isSelected == true {
            return
        }
        sender.isSelected = true
        if sender == self.stadiumBtn {
            self.medicalBtn.isSelected = false
            self.delegate?.didStadiumNavigationBarSelectIndex(index: 0)
        }else {
            self.stadiumBtn.isSelected = false
            self.delegate?.didStadiumNavigationBarSelectIndex(index: 1)

        }
    }
    
    
}
